< previous page page_442 next page >

Page 442
File errors are one of the oldest types of errors that can occur in your application and are listed in Table 16.1. These types of errors usually enable you to give the user a chance to correct the problem.
TABLE 16.1. GENERAL VISUAL BASIC FILE ERRORS.
Error CodeError Message
52Bad filename or number
53File not found
54Bad file mode
55File already open
58File already exists
59Bad record length
61Disk full
62Input past end of file
63Bad record number
64Bad filename
67Too many files
74Can't rename with different drive
75Path/File access error
76Path not found

Its important to know that these errors will not occur when you are accessing data within a database. Most of the time, you can create an error routine that anticipates these errors, prompts the user, and then returns the operation that caused the error. In some cases, you will not be able to prompt the user and retry the operation; you would then display a message giving the user the information or at least an error number that will help her identify and, hopefully, fix the problem.
Physical Errors
Another group of older common error is caused by problems that occur with the physical media or hardware on the user's computer. Printers that don't print, disk drives without disks, and disconnected communication ports are the most common examples of physical errors. These errors might or might not be fixed quickly by the user. Usually, you can report the error to the user, wait for them to fix the problem, and then either continue with the process or exit the application. As an example, if the application is trying to copy a file to a disk and there is no disk in the drive, all you need to do is tell the user

 
< previous page page_442 next page >

If you like this book, buy it!